<#include "/macro.include"/>
<#include "/java_copyright.include">
<#assign className = table.className>
<#assign classNameLower = className?uncap_first>
package ${basepackage}.service.impl;

import ${basepackage}.mapper.${className}Mapper;
import ${basepackage}.model.${className};
import ${basepackage}.service.${className}Service;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.ObjectUtils;
<#include "/java_imports.include">
@Slf4j
@Service
public class ${className}ServiceImpl implements ${className}Service{

	@Autowired
	private ${className}Mapper ${classNameLower}Mapper;

	/**  
     *   
     * <save one>  
     * @param ${classNameLower}  
     * @return ${table.pkColumn.simpleJavaType}
     */
	@Override
	public int insert(${className} ${classNameLower}){
		if(ObjectUtils.isEmpty(${classNameLower})){
			
		}
		return ${classNameLower}Mapper.insert(${classNameLower});
	}
	 /**  
     *   
     * <update one>  
     * @param ${classNameLower}  
     * @throws
     */
	@Override
	public int update(${className} ${classNameLower}){
		if(ObjectUtils.isEmpty(${classNameLower})){
			
		}
		return ${classNameLower}Mapper.update(${classNameLower});
	}

	 /**  
     *   
     * <find one by id>  
     * @param id  
     * @return ${className}
     */
	@Override
	public ${className} get(${table.idColumn.simpleJavaType} id){
		if(ObjectUtils.isEmpty(id)){
			
		}
		return ${classNameLower}Mapper.get(id);
	}
	/**  
     * <query all>  
     * @param paramMap  
     * @param pageBounds
     * @return List<${className}>
     */
	@Override
	public List<${className}> search(Map paramMap ,PageBounds pageBounds){
		if(ObjectUtils.isEmpty(paramMap)){
			
		}
		return ${classNameLower}Mapper.search(paramMap,pageBounds);
	}
	
	<#list table.columns as column>
	<#if column.unique && !column.pk>
	/**  
     *   
     * <find one by ${column.columnName}>  
     * @param id  
     * @return ${className}
     */
	@Override
	public ${className} getBy${column.columnName}(${column.simpleJavaType} ${column.columnNameFirstLower}){
		if(ObjectUtils.isEmpty(${column.columnNameFirstLower})){
			
		}
		return ${classNameLower}Mapper.getBy${column.columnName}(${column.columnNameFirstLower});

	 }
	</#if>
	</#list>
}